|
Operator [ ]
char operator[](int
index)
Return
Value
Returns the character at a given position in the string.
Parameters
index –Zero-based
index of a character in the string. If value of index is out
of string data range the runtime error will occure.
Remarks
You can think of a
string object as an array of characters. The overloaded
subscript ([ ]) operator returns a single character
specified by the zero-based index in index.
Example
The following
example demonstrates the use of operator [].
# Example for operator[]
string String = "Hello!"
Println(String[0])
Println(String[5])
Output of the example
script:
H
!
|